<template>
  <div v-loading="loading" element-loading-text="数据正在获取中" id="todo">
    <el-row>
      <el-col :span="7">
        <el-col :span="10" class="task">
          <div class="zrw">测试项</div>
          <!-- {{ csx_list }} -->
          <div v-for="(submenu, index) in csx_list" :key="index" @click="GetSelective(submenu, index)"
            :class="isActive1 === index ? 'active' : ''">
            <span class="csxrw">{{ index }}</span>
          </div>
        </el-col>
        <el-col v-if="SelectiveShooting != ''" :span="14" class="secondtask">
          <div class="zrw">测试子项</div>
          <div class="stlist">
            <div class='st' v-for="(submenu, index) in SelectiveShooting" :key="index"
              @click="TestTwo(submenu, groupIndex, index)" :class="isActive2 === index ? 'active' : ''">
              <el-checkbox :checked='submenu.sort === "" || submenu.sort ? true : false' :label="submenu.sort"
                :key="submenu.id" @change="TestALL(index)"
                v-if="submenu.values !== '对比度复现-日落' && TestName !== 'none' && TestName !== '方向均匀性' && TestName !== '帧率' && TestName !== '闪烁' && TestName !== '系统延时' && TestName !== '成像时间' && TestName !== '双点光源' && TestName !== '弥散' && TestName !== '光晕和炫光'">
              </el-checkbox>

              <span class="zrwzt" :title="submenu.id">
                {{ submenu.values }}
              </span>
            </div>
          </div>


        </el-col>


      </el-col>


      <el-col :span="13" class="overflow-x-hidden">

        <div class="zrw">参数配置</div>

        <div class="container_list">
        <div class="container">
          <div class="left-content">导轨位置</div>
          <div class="right-content">
            导轨名称:
            <el-select v-model="tableData.GuideRailPosition.id" placeholder="请选择" style="
                  height: 10px;
                  margin-top: -10px;
                  color: green;
                  text-align: center;
                  background-color: #262626;
                " class="my_button_style" @change="UpdateTableDataGuideRailPosition" filterable>
              <el-option v-for="item in cmslocationlist" :key="item.id" :label="item.cms_auto_name" :value="item.id">
                {{ item.cms_auto_name }}
              </el-option>
            </el-select>
          </div>
          <div class="right-content">
            导&nbsp;轨&nbsp;移&nbsp;动&nbsp;:&nbsp;&nbsp;&nbsp;

            <el-button @click="autoidcms">
              移动
            </el-button>
          </div>

        </div>





        <div class="container" v-if="
          TestName !== '帧率' &&
          TestName !== '闪烁' &&
          TestName !== '系统延时' &&
          TestName !== '成像时间'
        ">
          <div class="left-content">亮度计设置</div>
          <div class="right-content" v-if="this.brightness_id == 1">
            I29&nbsp;名&nbsp;称:
            <el-select v-model="tableData.I29Position.id" placeholder="请选择" style="
                  height: 10px;
                  margin-top: -10px;
                  color: green;
                  text-align: center;
                " @change="UpdateTableDataI29Position" filterable>
              <el-option v-for="item in I29" :key="item.id" :label="item.name_file" :value="item.id">
                {{ item.name_file }}
              </el-option>
            </el-select>
          </div>
          <div class="right-content" v-if="this.brightness_id == 2">
            亮度及名称:
            <el-select v-model="tableData.KernelPosition.id" placeholder="请选择" style="
                  height: 10px;
                  margin-top: -10px;
                  color: green;
                  text-align: center;
                " @change="UpdateTableDataKernelPosition" filterable>
              <el-option v-for="item in kernel_list" :key="item.id" :label="item.kernel_name" :value="item.id">
                {{ item.kernel_name }}
              </el-option>
            </el-select>
          </div>
        </div>

        <div v-if="
          TestName !== '帧率' &&
          TestName !== '闪烁' &&
          TestName !== '系统延时' &&
          TestName !== '成像时间' &&
          this.brightness_id == 1
        ">
          <div class="container">
            <div class="right-content">
              截&nbsp;图&nbsp;设&nbsp;置&nbsp;:&nbsp;&nbsp;&nbsp;


              <button style="width: 130px; height: 30px; background-color: #8e44ad" @click="ShowSubFrameDialog">
                开启
              </button>
            </div>
            <div class="right-content">
              拍&nbsp;摄&nbsp;照&nbsp;片&nbsp;:&nbsp;&nbsp;&nbsp;

              <button style="width: 130px; height: 30px; background-color: #f39c12" @click="is_address = true">
                拍摄
              </button>
            </div>
            <div class="right-content">
              实&nbsp;时&nbsp;图&nbsp;像&nbsp;:&nbsp;&nbsp;&nbsp;

              <button style="width: 130px; height: 30px; background-color: #8e44ad" @click="showmodeform">
                开启
              </button>
            </div>
          </div>
        </div>

        <div v-if="
          TestName !== '帧率' &&
          TestName !== '闪烁' &&
          TestName !== '系统延时' &&
          TestName !== '成像时间' &&
          this.brightness_id == 2
        ">
          <div class="container">
            <div class="zdg" style="display: flex; align-items: center">
              拍&nbsp;摄&nbsp;照&nbsp;片&nbsp;:&nbsp;&nbsp;&nbsp;

              <button style="width: 130px; height: 30px; background-color: #f39c12" @click="is_address_kernel = true">
                拍摄
              </button>
            </div>
          </div>
        </div>



        <div class="container">
          <div class="left-content">补光灯设置</div>

          <div class="left-content-light">
            灯光名称:

            <el-select v-model="tableData.LightPosition.id" placeholder="请选择" style="height: 10px; margin-top: -10px"
              @change="LightPositionLightPosition" filterable>
              <el-option v-for="item in light_list" :key="item.id" :label="item.username" :value="item.id">
                {{ item.username }}
              </el-option>
            </el-select>
          </div>

          <div class="right-content" style="display: flex; align-items: center">
            开&nbsp;启&nbsp;灯&nbsp;光&nbsp;:&nbsp;&nbsp;&nbsp;

            <button style="width: 130px; height: 30px; background-color: #f39c12" @click="light_start">
              开启
            </button>
          </div>
          <div class="right-content" style="display: flex; align-items: center">
            关&nbsp;闭&nbsp;灯&nbsp;光&nbsp;:&nbsp;&nbsp;&nbsp;

            <button style="width: 130px; height: 30px; background-color: #e74c3c" @click="light_stop">
              关闭
            </button>
          </div>
        </div>



        <div class="container" v-if="
          TestName === '对比度复现-日落' ||
          TestName === '弥散' ||
          TestName === '光晕和炫光'
        ">
          <div class="left-content">OF500设置</div>
        </div>
        <div class="container" v-if="
          TestName === '对比度复现-日落' ||
          TestName === '弥散' ||
          TestName === '光晕和炫光'
        ">

          <div class="right-content">
            &nbsp;开&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;启&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;&nbsp;

            <button style="width: 130px; height: 30px; background-color: #0fab5d" @click="OF500Start">
              开启
            </button>
          </div>
          <div class="right-content" style="display: flex; align-items: center">
            &nbsp;&nbsp;关&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;闭&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;&nbsp;

            <button style="width: 130px; height: 30px; background-color: #ff4500" @click="OF500Stop">
              关闭
            </button>
          </div>
          <div class="right-content" v-if="TestName === '光晕和炫光'">
            请手动将OF500发光口旋转至水平0°
          </div>
          <div class="right-content" v-if="TestName === '对比度复现-日落' || TestName === '弥散'">
            请手动将OF500发光口旋转与水平夹角10°
          </div>

        </div>



        <div class="container" v-if="TestName === '闪烁' || TestName === '对比度复现/散射环境白天'">
          <div class="left-content">天空散射灯配置</div>
          <div class="left-content-light">
            灯光名称:
            <el-select v-model="tableData.KeylightPosition.id" placeholder="请选择" style="
                  height: 10px;
                  margin-top: -10px;
                  color: green;
                  text-align: center;
                " @change="SkyLightPosition" filterable>
              <el-option v-for="item in skylight_list" :key="item.id" :label="item.sky_username" :value="item.id">
                {{ item.sky_username }}
              </el-option>
            </el-select>
          </div>


          <div class="right-content" style="display: flex; align-items: center">
            开&nbsp;启&nbsp;灯&nbsp;光&nbsp;:&nbsp;&nbsp;&nbsp;

            <button style="width: 130px; height: 30px; background-color: #0fab5d" @click="SkyStart">
              开启
            </button>
          </div>
          <div class="right-content" style="display: flex; align-items: center">
            关&nbsp;闭&nbsp;灯&nbsp;光&nbsp;:&nbsp;&nbsp;&nbsp;

            <button style="width: 130px; height: 30px; background-color: #ff4500" @click="SkyStop">
              关闭
            </button>
          </div>
        </div>




        <div class="container" v-if="TestName === '对比度复现/直接日光照射'">
          <div class="left-content">太阳光直射(PL1C05)设置</div>
          <div class="right-content">
            灯光名称:
            <el-select v-model="tableData.PL1C05ONE.id" placeholder="请选择" style="
                  height: 10px;
                  margin-top: -10px;
                  color: green;
                  text-align: center;
                " @change="PL1C05Position" filterable>
              <el-option v-for="item in sunlight_list" :key="item.id" :label="item.PL1C05_username" :value="item.id">
                {{ item.PL1C05_username }}
              </el-option>
            </el-select>
          </div>
        </div>
        <div class="container" v-if="TestName === '对比度复现/直接日光照射'">
          <div class="right-content">
            灯&nbsp;光&nbsp;照&nbsp;度&nbsp;:&nbsp;&nbsp;&nbsp;

            <input style="
                  width: 130px;
                  height: 30px;
                  background: #262626;
                  border-radius: 0px;
                  color: #0fab5d;
                  text-align: center;
                " v-model="tableData.PL1C05ONE.PL1C05_lux" />
          </div>
          <div class="right-content">
            PL1C05导轨&nbsp;&nbsp;:&nbsp;&nbsp;&nbsp;

            <input style="
                  width: 130px;
                  height: 30px;
                  background: #262626;
                  border-radius: 0px;
                  color: #0fab5d;
                  text-align: center;
                " readonly v-model="textValue" />
          </div>
          <div class="right-content">
            &nbsp;&nbsp;开&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;启&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;&nbsp;

            <button style="width: 130px; height: 30px; background-color: #0fab5d" @click="PL1C05Start">
              开启
            </button>
          </div>
          <div class="right-content">
            &nbsp;&nbsp;关&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;闭&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;&nbsp;

            <button style="width: 130px; height: 30px; background-color: #ff4500" @click="PL1C05Stop">
              关闭
            </button>
          </div>

        </div>

        <div class="container" v-if="TestName === '双点光源'">
          <div class="left-content">双点光源设置</div>

          <div class="right-content">
            &nbsp;&nbsp;开&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;启&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;&nbsp;

            <button style="width: 130px; height: 30px; background-color: #0fab5d" @click="TwoPointLightStart">
              开启
            </button>
          </div>
          <div class="right-content">
            &nbsp;&nbsp;关&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;闭&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;&nbsp;

            <button style="width: 130px; height: 30px; background-color: #ff4500" @click="TwoPointLightStop">
              关闭
            </button>
          </div>
          <div class="right-content">
            双点光源导轨:&nbsp;&nbsp;&nbsp;

            <input style="
                  width: 130px;
                  height: 30px;
                  background: #262626;
                  border-radius: 0px;
                  color: #0fab5d;
                  text-align: center;
                " readonly v-model="textValue" />
          </div>
        </div>
        <div class="container" v-if="TestALLName === '景深|分辨率'">
          <div class="left-content">景深卡</div>

          <div class="right-content" style="display: flex; align-items: center">
            景&nbsp;&nbsp;&nbsp;深&nbsp;&nbsp;&nbsp;卡&nbsp;&nbsp;:&nbsp;&nbsp;&nbsp;

            <input style="
                  width: 130px;
                  height: 30px;
                  background: #262626;
                  border-radius: 0px;
                  color: #0fab5d;
                  text-align: center;
                " readonly v-model="textValue" />
          </div>
        </div>


        <div class="container" v-if="
          TestName === '成像时间' ||
          TestName === '系统延时' ||
          TestName === '闪烁'
        ">
          <div class="left-content">Filcker <div style="display: flex; align-items: center; color: red;float: right;">
              保&nbsp;存&nbsp;路&nbsp;径:&nbsp;&nbsp;&nbsp;

              C:\CMS\CMSAPI\media\Filcker\
            </div>
          </div>


          <div class="right-content">
            通&nbsp;&nbsp;道&nbsp;&nbsp;增&nbsp;&nbsp;益&nbsp;&nbsp;:&nbsp;&nbsp;&nbsp;

            <select v-model="Filcker_GainIndex" style="
                  width: 130px;
                  height: 30px;
                  background: #262626;
                  border-radius: 0px;
                  color: #0fab5d;
                  text-align: center;
                ">
              <option v-for="item in Filcker_GainIndex_list" :key="item.id" :label="item.value" :value="item.id">
                {{ item.value }}
              </option>
            </select>
          </div>
          <div class="right-content">
            采&nbsp;样&nbsp;频&nbsp;率&nbsp;:&nbsp;&nbsp;&nbsp;

            <select v-model="Filcker_FreIndex" style="
                  width: 130px;
                  height: 30px;
                  background: #262626;
                  border-radius: 0px;
                  color: #0fab5d;
                  text-align: center;
                ">
              <option v-for="item in Filcker_FreIndex_list" :key="item.id" :label="item.value" :value="item.id">
                {{ item.value }}
              </option>
            </select>
          </div>
          <div class="right-content">
            采样时间(ms):&nbsp;&nbsp;&nbsp;

            <input style="
                  width: 130px;
                  height: 30px;
                  background: #262626;
                  border-radius: 0px;
                  color: #0fab5d;
                  text-align: center;
                " v-model="acquisition_time" />
          </div>

          <div class="right-content">
            保存文件名:&nbsp;&nbsp;&nbsp;

            <input style="
                  width: 130px;
                  height: 30px;
                  background: #262626;
                  border-radius: 0px;
                  color: #0fab5d;
                  text-align: center;
                " v-model="FilckerUsername" />
          </div>
          <!-- </div>

        <div class="container" v-if="
          TestName === '成像时间' ||
          TestName === '系统延时' ||
          TestName === '闪烁'
        "> -->

          <div class="right-content">
            &nbsp;&nbsp;连&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;接&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;&nbsp;

            <button style="width: 130px; height: 30px; background-color: #0fab5d" @click="FilckerInit">
              连接Filcker
            </button>
          </div>
          <div class="right-content">
            &nbsp;&nbsp;断&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;开&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;&nbsp;

            <button style="width: 130px; height: 30px; background-color: #ff4500" @click="FilckerBreak">
              断开Filcker
            </button>
          </div>
          <div class="right-content">
            开&nbsp;&nbsp;始&nbsp;&nbsp;采&nbsp;&nbsp;集&nbsp;&nbsp;:&nbsp;&nbsp;&nbsp;

            <button @click="datacollection_filcker" style="width: 130px; height: 30px; background-color: white"
              v-if="TestName === '闪烁'">
              开始采集
            </button>
            <button @click="StartCollection" style="width: 130px; height: 30px; background-color: #f39c12" v-else>
              开始采集
            </button>
          </div>
        </div>

        <div class="container">
          <div class="left-content">图卡编号</div>
          <div class="right-content">
            图卡选项:

            <el-select v-model="tableData.picture_one.id" placeholder="请选择" style="height: 10px; margin-top: -10px"
              @change="LightPositionLightPosition" filterable>
              <el-option v-for="item in card_list" :key="item.id" :label="item.card_name" :value="item.id">
                {{ item.card_name }}
              </el-option>
            </el-select>


          </div>

        </div>

        <div class="tud">
          <el-button type="primary" @click="TestUpdate">
            将当前配置设为默认值
          </el-button>
          <div class="fileandstart"
            v-if="TestName !== '方向均匀性' && TestName !== '帧率' && TestName !== '闪烁' && TestName !== '系统延时' && TestName !== '成像时间' && TestName !== '双点光源' && TestName !== '弥散' && TestName !== '光晕和炫光'">
            <input v-model="save_file.url" />


            <el-button type="success" @click="bring_on">
              开始任务
            </el-button>
            <el-button type="success" @click="updatefile">
              保存路径
            </el-button>
          </div>


        </div>


      </div>
      </el-col>

      <el-col :span="4">


        <div class="zrw">正在执行的任务</div>
        <div class="globalValue">
            <!-- <p>执行任务：</p> -->
            <p>{{ globalValue }}</p>
          </div>
          <el-col :span="24" class="custom-table">
            <div style="height: 91vh; overflow: auto; position: relative;">
              <el-table class="custom-table" height="83%" stripe border :data="selectedItems1"
                style="width:250px;color:#262626">
                <el-table-column  fixed prop="name" label="全部要执行的任务">
                </el-table-column>
              </el-table>
            </div>
          </el-col>
       


      </el-col>
    </el-row>

    <el-dialog v-loading="loading_angle" element-loading-text="正在拍摄图片请稍等" title="I29拍摄图片" :visible.sync="is_address"
      width="30%" :before-close="handleClose_is_createtask">
      <el-form>
        <el-form-item label="保存文件名:" :label-width="formLabelWidth">
          <el-input v-model="address_username"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="is_address = false">取 消</el-button>
        <el-button type="primary" @click="shoot">确 定</el-button>
      </div>
    </el-dialog>
    <el-dialog v-loading="loading_angle" element-loading-text="正在拍摄图片请稍等" title="kernel拍摄图片"
      :visible.sync="is_address_kernel" width="30%" :before-close="handleClose_is_createtask">
      <el-form>
        <el-form-item label="保存文件名:" :label-width="formLabelWidth">
          <el-input v-model="address_username"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="is_address_kernel = false">取 消</el-button>
        <el-button type="primary" @click="shoot_kernel">确 定</el-button>
      </div>
    </el-dialog>
    <el-dialog title="保存路径" :visible.sync="is_bring_on" :before-close="handleClose_is_createtask" width="30%">
      <el-form style="background-color: #262626">
        <el-form-item label="保存文件夹名称:" :label-width="formLabelWidth">
          {{ save_file.url }}\
          <el-input v-model="save_file.savefileone" style="width: 200px"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="is_bring_on = false">取 消</el-button>
        <el-button type="primary" @click="bring">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import Footer from "@/components/common/Footer";
import Vue from "vue"; // 如果Vue没有在该文件中直接导入的话，需要引入Vue

import { todoApis } from "@/utils/apis";

export default {
  created() {
    this.ListMainTask();
    this.savefile();
    this.CardList();
    this.startLongPolling()
    this.startLongPolling1()
    this.getbrightness()
    this.geekernelSetting()
  },
  data() {
    return {

      is_address_kernel: false,
      brightness_id: 0,
      loading_angle: false,
      globalValue: '无任务',
      socket: null,
      kernel_list: [],
      selectedItems: [], // 用于存储选定项目的数组
      selectedItems1: [],
      is_bring_on: false,
      save_file: "",
      file: "",
      selectedFilePath: null,
      picture_sort: "",
      loading: false,
      address_username: "",
      is_address: false,
      formLabelWidth: "120",
      Task_id: "",
      FilckerUsername: "",
      textValue: "手动",
      SelectiveShooting: "",
      csx_list: "",
      isActive: 0,
      isActive1: '帧率',
      isActive2: 0,
      main_take_name: "",
      selectedSubmenuIndex: null,
      tableData: "",
      options: [],
      I29: "",
      light_list: "",
      skylight_list: "",
      sunlight_list: "",
      cmslocationlist: "",
      checkedItems: [],
      main_id: 1,
      is_options: false,
      num: 1,
      TestName: "",
      TestALLName: "",
      groupIndex: "",
      Filcker_GainIndex: 1,
      Filcker_FreIndex: 0,
      Filcker_GainIndex_list: [
        { id: 1, value: "*100K" },
        { id: 2, value: "*10M" },
        { id: 3, value: "*1G" },
      ],
      card_list: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
      Filcker_FreIndex_list: [
        { id: 0, value: "2.5M BPS" },
        { id: 1, value: "2M BPS" },
        { id: 2, value: "1M BPS" },
        { id: 3, value: "500K BPS" },
        { id: 4, value: "400K BPS" },
        { id: 5, value: "200K BPS" },
        { id: 6, value: "100K BPS" },
      ],
      acquisition_time: 0,
    };
  },
  components: {
    Footer,
  },
  mounted() {

  },
  methods: {
    // 获取当前使用的照度计
    getbrightness() {
      this.$axios.get(this.$settings.BASE_URL_CMS + `CMS-Task/getbrightness/`).then((res) => {
        if (res.data.code == 100) {
          console.log('brightness_id', res.data.data)
          this.brightness_id = res.data.data
        }
      })
    },
    // 获取kernel亮度计配置
    geekernelSetting() {
      this.$axios.get(this.$settings.BASE_URL_CMS + `CMS-Kernel/KernelList/`).then((res) => {
        if (res.data.code == 100) {
          console.log('brightness_id', res.data.data)
          this.kernel_list = res.data.data
        }
      })
    },
    // 获取kernel单个亮度计配置
    UpdateTableDataKernelPosition() {
      this.$axios
        .get(
          this.$settings.BASE_URL_CMS +
          `CMS-Kernel/KernelList/${this.tableData.KernelPosition.id}/`
        )
        .then((res) => {
          if (res.data.code == 100) {
            console.log('KernelList', res.data.data)
            this.tableData.KernelList = res.data.data;
          }
        });
    },
    // 查询正在执行的任务
    startLongPolling() {
      this.intervalId = setInterval(() => {
        this.socketing();
      }, 5000);
    },
    socketing() {
      this.$axios.get(this.$settings.BASE_URL_CMS + `CMS-Task/fetch_task/`).then((res) => {
        if (res.data.code == 100) {
          this.globalValue = res.data.data
        }
      })
    },
    startLongPolling1() {
      this.intervalId1 = setInterval(() => {
        this.socketing1();
      }, 5000);
    },
    socketing1() {
      this.$axios.get(this.$settings.BASE_URL_CMS + `CMS-Task/fetch_task_list/`).then((res) => {
        if (res.data.code == 100) {
          this.selectedItems1 = res.data.data
        }
      })
    },
    bring_on() {
      this.is_bring_on = true;
    },
    savefile() {
      this.$axios
        .get(this.$settings.BASE_URL_CMS + `CMS-Task/savefiles/`)
        .then((res) => {
          if (res.data.code == 100) {
            // print(res.data.data[0])
            this.save_file = res.data.data[0];
          }
        });
    },
    updatefile() {
      this.$axios
        .patch(this.$settings.BASE_URL_CMS + `CMS-Task/savefiles/1/`, {
          url: this.save_file.url,
          savefileone: this.save_file.savefileone,
        })
        .then((res) => {
          if (res.data.code == 100) {
            this.$message({
              message: "修改成功",
              type: "success",
            });
            this.save_file = res.data.data[0].url;
          } else {
            this.$message.error("修改失败");
          }
        });
    },
    // 修改灯光
    update_light() {
      this.$axios
        .put(
          this.$settings.BASE_URL_CMS +
          `lightauto/light_update/${this.tableData.LightPosition.id}/`,
          {
            username: this.tableData.LightPosition.username,
            lux: parseInt(this.tableData.LightPosition.lux),
            cct: parseInt(this.tableData.LightPosition.cct),
          }
        )
        .then((res) => {
          if (res.data.code == 100) {
            this.$message({
              message: res.data.msg,
              type: "success",
            });
          } else {
            this.$message.error(res.data.msg);
          }
        })
        .catch((error) => {
          this.$message.error(error);
        });
    },
    // filcker闪烁测试保存数据
    datacollection_filcker() {
      this.loading = true;
      this.$axios
        .get(
          this.$settings.BASE_URL_CMS +
          `filcker/datacollection_filcker/?gainIndex=${this.Filcker_GainIndex}&Frequency=${this.Filcker_FreIndex}&acquisition_time=${this.acquisition_time}&username=${this.FilckerUsername}`
        )
        .then((res) => {
          if (res.data.code == 100) {
            this.$message({
              message: res.data.msg,
              type: "success",
            });
            this.loading = false;
          } else {
            this.$message.error(res.data.msg);
            this.loading = false;
          }
        });
    },
    // 修改I29配置
    i29update() {
      this.$axios
        .put(
          this.$settings.BASE_URL_CMS +
          `brightness_auto/i29update/${this.tableData.I29Position.id}/`,
          {
            name_file: this.tableData.I29Position.name_file,
            is_exposure: this.tableData.I29Position.is_exposure,
            filter_state_red: this.tableData.I29Position.filter_state_red,
            filter_state_green: this.tableData.I29Position.filter_state_green,
            filter_state_blue: this.tableData.I29Position.filter_state_blue,
            filter_state_xb: this.tableData.I29Position.filter_state_xb,
            is_filter_state_red: this.tableData.I29Position.is_filter_state_red,
            is_filter_state_green:
              this.tableData.I29Position.is_filter_state_green,
            is_filter_state_blue:
              this.tableData.I29Position.is_filter_state_blue,
            is_filter_state_xb: this.tableData.I29Position.is_filter_state_xb,
            focus_distance: this.tableData.I29Position.focus_distance,
            aperture: this.tableData.I29Position.aperture,
            color_calibration_id:
              this.tableData.I29Position.color_calibration_id,
            color_calibration_value:
              this.tableData.I29Position.color_calibration_value,
            color_shiftCorrection_id:
              this.tableData.I29Position.color_shiftCorrection_id,
            color_shiftCorrection_value:
              this.tableData.I29Position.color_shiftCorrection_value,
          }
        )
        .then((res) => {
          if (res.data.code == 100) {
            this.$message({
              message: res.data.msg,
              type: "success",
            });
          } else {
            this.$message.error(res.data.msg);
          }
        });
    },
    // 截图设置
    ShowSubFrameDialog() {
      this.$axios.get(this.$settings.BASE_URL_CMS + 'brightness_auto/showframedialog/').then((res) => {
        if (res.data.code == 100) {
          this.GetSubFrameRegion()
          this.$message({
            message: res.data.msg,
            type: 'success'
          });
        }
      })
    },
    // 实时图像
    showmodeform() {
      this.$axios
        .get(this.$settings.BASE_URL_CMS + `brightness_auto/showmodeform/`)
        .then((res) => {
          if (res.data.code == 100) {
            this.$message({
              message: res.data.msg,
              type: "success",
            });
          } else {
            this.$message.error(res.data.msg);
          }
        });
    },
    // 拍摄
    shoot() {
      this.loading_angle = true
      this.$axios
        .get(
          this.$settings.BASE_URL_CMS +
          `brightness_auto/takement/?address=${this.address_username}&id=${this.tableData.I29Position.id}`
        )
        .then((res) => {
          if (res.data.code == 100) {
            this.loading_angle = false
            this.is_address = false
            this.$message({
              message: res.data.msg,
              type: "success",
            });
          } else {
            this.loading_angle = false
            this.is_address = false
            this.$message.error(res.data.msg);
          }
        });
    },
    // kernel拍摄
    shoot_kernel() {
      this.loading_angle = true
      this.$axios
        .get(
          this.$settings.BASE_URL_CMS +
          `CMS-Kernel/ShootPicture/?address=${this.address_username}&id=${this.tableData.KernelPosition.id}`
        )
        .then((res) => {
          if (res.data.code == 100) {
            this.loading_angle = false
            this.is_address_kernel = false
            this.$message({
              message: res.data.msg,
              type: "success",
            });
          } else {
            this.loading_angle = false
            this.is_address = false
            this.$message.error(res.data.msg);
          }
        });
    },
    // 修改导轨位置
    updatecms() {
      this.$axios
        .put(
          this.$settings.BASE_URL_CMS +
          `cmsauto/cmsautoupdate/${this.tableData.GuideRailPosition.id}/`,
          {
            cms_auto_name: this.tableData.GuideRailPosition.cms_auto_name,
            cms_auto_0: this.tableData.GuideRailPosition.cms_auto_0,
            cms_auto_1: this.tableData.GuideRailPosition.cms_auto_1,
            cms_auto_2: this.tableData.GuideRailPosition.cms_auto_2,
            cms_auto_3: this.tableData.GuideRailPosition.cms_auto_3,
            cms_auto_4: this.tableData.GuideRailPosition.cms_auto_4,
            cms_auto_5: this.tableData.GuideRailPosition.cms_auto_5,
            cms_auto_6: this.tableData.GuideRailPosition.cms_auto_6,
            cms_auto_7: this.tableData.GuideRailPosition.cms_auto_7,
            cms_auto_8: this.tableData.GuideRailPosition.cms_auto_8,
            cms_auto_9: this.tableData.GuideRailPosition.cms_auto_9,
            cms_auto_10: this.tableData.GuideRailPosition.cms_auto_10,
            cms_auto_11: this.tableData.GuideRailPosition.cms_auto_11,
            cms_auto_12: this.tableData.GuideRailPosition.cms_auto_12,
            cms_auto_13: this.tableData.GuideRailPosition.cms_auto_13,
            cms_auto_14: this.tableData.GuideRailPosition.cms_auto_14,
            cms_auto_15: this.tableData.GuideRailPosition.cms_auto_15,
            cms_auto_16: this.tableData.GuideRailPosition.cms_auto_16,
            cms_auto_17: this.tableData.GuideRailPosition.cms_auto_17,
          }
        )
        .then((res) => {
          if (res.data.code == 100) {
            this.$message({
              message: res.data.msg,
              type: "success",
            });
          } else {
            this.$message.error(res.data.msg);
          }
        });
    },
    // 移动导轨
    autoidcms() {
      this.$axios
        .get(
          this.$settings.BASE_URL_CMS +
          `CMS-Task/autoidcms/?id=${this.tableData.GuideRailPosition.id}`
        )
        .then((res) => {
          if (res.data.code == 100) {
            this.$message({
              message: res.data.msg,
              type: "success",
            });
          } else {
            this.$message.error(res.data.msg);
          }
        });
    },
    // Filcker连接
    FilckerInit() {
      this.$axios
        .get(this.$settings.BASE_URL_CMS + `filcker/filckerinit/`)
        .then((res) => {
          if (res.data.code == 100) {
            this.$message({
              message: res.data.msg,
              type: "success",
            });
          } else {
            this.$message.error(res.data.msg);
          }
        });
    },
    // Filcker断开
    FilckerBreak() {
      this.$axios
        .get(this.$settings.BASE_URL_CMS + `filcker/filckerbreak/`)
        .then((res) => {
          if (res.data.code == 100) {
            this.$message({
              message: res.data.msg,
              type: "success",
            });
          } else {
            this.$message.error(res.data.msg);
          }
        });
    },
    // 开灯
    light_start() {
      this.$axios
        .get(
          this.$settings.BASE_URL_CMS +
          `Ccxl/light/LightRLStart/?lux=${this.tableData.LightPosition.lux}&cct=${this.tableData.LightPosition.cct}`
        )
        .then((res) => {
          if (res.data.code == 100) {
            this.$message({
              message: res.data.msg,
              type: "success",
            });
          } else {
            this.$message.error(res.data.msg);
          }
        });
    },
    // 关灯
    light_stop() {
      this.$axios
        .get(this.$settings.BASE_URL_CMS + `Ccxl/light/LightRLStop/`)
        .then((res) => {
          if (res.data.code == 100) {
            this.$message({
              message: res.data.msg,
              type: "success",
            });
          } else {
            this.$message.error(res.data.msg);
          }
        });
    },
    // 连接光源
    LightInit() {
      this.$axios
        .get(this.$settings.BASE_URL_CMS + `lightauto/lightinit/`)
        .then((res) => {
          if (res.data.code == 100) {
            this.$message({
              message: res.data.msg,
              type: "success",
            });
          } else {
            this.$message.error(res.data.msg);
          }
        });
    },
    // 断开连接
    LightBreak() {
      this.$axios
        .get(this.$settings.BASE_URL_CMS + `lightauto/lightbreak/`)
        .then((res) => {
          if (res.data.code == 100) {
            this.$message({
              message: res.data.msg,
              type: "success",
            });
          } else {
            this.$message.error(res.data.msg);
          }
        });
    },
    // 获取天空散射光配置
    SunLightList() {
      this.$axios
        .get(this.$settings.BASE_URL_CMS + `PL1C05/PL1C05List/`)
        .then((res) => {
          if (res.data.code == 100) {
            this.sunlight_list = res.data.data;
          }
        });
    },
    // 开始采集
    StartCollection() {
      this.$axios
        .get(
          this.$settings.BASE_URL_CMS +
          `filcker/datacollection/?gainIndex=${this.Filcker_GainIndex}&Frequency=${this.Filcker_FreIndex}&acquisition_time=${this.acquisition_time}&username=${this.FilckerUsername}`
        )
        .then((res) => {
          if (res.data.code == 100) {
            this.$message({
              message: res.data.msg,
              type: "success",
            });
          } else {
            this.$message.error(res.data.msg);
          }
        });
    },
    // 开启PL1C05
    PL1C05Start() {
      this.$axios
        .get(
          this.$settings.BASE_URL_CMS +
          `PL1C05/PL1C05/LightPL1C05Start/?lux=${this.tableData.PL1C05ONE.PL1C05_lux}`
        )
        .then((res) => {
          if (res.data.code == 100) {
            this.$message({
              message: res.data.msg,
              type: "success",
            });
          } else {
            this.$message.error(res.data.msg);
          }
        });
    },
    // 开启PL1C05
    PL1C05Stop() {
      this.$axios
        .get(this.$settings.BASE_URL_CMS + `PL1C05/PL1C05/LightPL1C05Stop/`)
        .then((res) => {
          if (res.data.code == 100) {
            this.$message({
              message: res.data.msg,
              type: "success",
            });
          } else {
            this.$message.error(res.data.msg);
          }
        });
    },
    // 开启双点光源
    TwoPointLightStart() {
      this.$axios
        .get(this.$settings.BASE_URL_CMS + `CMS-TwoPoint/TwopointLight/LightTwoPointStart/`)
        .then((res) => {
          if (res.data.code == 100) {
            this.$message({
              message: res.data.msg,
              type: "success",
            });
          } else {
            this.$message.error(res.data.msg);
          }
        });
    },
    //关闭双点光源
    TwoPointLightStop() {
      this.$axios
        .get(this.$settings.BASE_URL_CMS + `CMS-TwoPoint/TwopointLight/LightTwoPointStop/`)
        .then((res) => {
          if (res.data.code == 100) {
            this.$message({
              message: res.data.msg,
              type: "success",
            });
          } else {
            this.$message.error(res.data.msg);
          }
        });
    },
    // 开启OF500
    OF500Start() {
      this.$axios
        .get(this.$settings.BASE_URL_CMS + `CMS-OF500/OF500/LightOF500Start/`)
        .then((res) => {
          if (res.data.code == 100) {
            this.$message({
              message: res.data.msg,
              type: "success",
            });
          } else {
            this.$message.error(res.data.msg);
          }
        });
    },
    // 关闭OF500
    OF500Stop() {
      this.$axios
        .get(this.$settings.BASE_URL_CMS + `CMS-OF500/OF500/LightOF500Stop/`)
        .then((res) => {
          if (res.data.code == 100) {
            this.$message({
              message: res.data.msg,
              type: "success",
            });
          } else {
            this.$message.error(res.data.msg);
          }
        });
    },
    // 天空散射光
    SkyStart() {
      this.$axios
        .get(
          this.$settings.BASE_URL_CMS +
          `LS2CM/LS2CM/LightLS2CMStart/?lux=${this.tableData.KeylightPosition.sky_lux}&cct=${this.tableData.KeylightPosition.sky_cct}`
        )
        .then((res) => {
          if (res.data.code == 100) {
            this.$message({
              message: res.data.msg,
              type: "success",
            });
          } else {
            this.$message.error(res.data.msg);
          }
        });
    },
    SkyStop() {
      this.$axios
        .get(this.$settings.BASE_URL_CMS + `LS2CM/LS2CM/LightLS2CMStop/`)
        .then((res) => {
          if (res.data.code == 100) {
            this.$message({
              message: res.data.msg,
              type: "success",
            });
          } else {
            this.$message.error(res.data.msg);
          }
        });
    },
    // 修改天空散射灯
    update_sky() {
      this.$axios
        .put(
          this.$settings.BASE_URL_CMS +
          `lightauto/skylights/${this.tableData.KeylightPosition.id}/`,
          {
            sky_username: this.tableData.KeylightPosition.sky_username,
            sky_lux: parseInt(this.tableData.KeylightPosition.sky_lux),
            sky_cct: parseInt(this.tableData.KeylightPosition.sky_cct),
            sky_eight: parseInt(this.tableData.KeylightPosition.sky_eight),
            sky_nine: parseInt(this.tableData.KeylightPosition.sky_nine),
          }
        )
        .then((res) => {
          if (res.data.code == 100) {
            this.$message({
              message: res.data.msg,
              type: "success",
            });
          } else {
            this.$message.error(res.data.msg);
          }
        });
    },
    // 开启图卡补光光源
    OneTwoStart() {
      this.$axios
        .get(
          this.$settings.BASE_URL_CMS +
          `lightauto/onetwostart/?lux=${this.tableData.LightPosition.lux}&cct=${this.tableData.LightPosition.cct}`
        )
        .then((res) => {
          if (res.data.code == 100) {
            this.$message({
              message: res.data.msg,
              type: "success",
            });
          } else {
            this.$message.error(res.data.msg);
          }
        });
    },
    // 关闭图卡补光光源
    OneTwoStop() {
      this.$axios
        .get(this.$settings.BASE_URL_CMS + `lightauto/onetwostop/`)
        .then((res) => {
          if (res.data.code == 100) {
            this.$message({
              message: res.data.msg,
              type: "success",
            });
          } else {
            this.$message.error(res.data.msg);
          }
        });
    },
    // 获取天空散射光列表
    SkyLightList() {
      this.$axios
        .get(this.$settings.BASE_URL_CMS + `Ccxl/SkyLightList/`)
        .then((res) => {
          if (res.data.code == 100) {
            this.skylight_list = res.data.data;
          }
        });
    },
    // 连接Timer
    TimerInit() {
      this.$axios
        .get(this.$settings.BASE_URL_CMS + `timer/timerinit/`)
        .then((res) => {
          if (res.data.code == 100) {
            this.$message({
              message: res.data.msg,
              type: "success",
            });
          } else {
            this.$message.error(res.data.msg);
          }
        });
    },
    // 断开Timer
    TimerBreak() {
      this.$axios
        .get(this.$settings.BASE_URL_CMS + `timer/timerbreak/`)
        .then((res) => {
          if (res.data.code == 100) {
            this.$message({
              message: res.data.msg,
              type: "success",
            });
          } else {
            this.$message.error(res.data.msg);
          }
        });
    },
    // 开启timer
    TimerStart() {
      this.$axios
        .get(
          this.$settings.BASE_URL_CMS +
          `timer/timerparameter/?hz=${this.tableData.timer_hz}`
        )
        .then((res) => {
          if (res.data.code == 100) {
            this.$message({
              message: res.data.msg,
              type: "success",
            });
          } else {
            this.$message.error(res.data.msg);
          }
        });
    },
    // 关闭Timer
    TimerStop() {
      this.$axios
        .get(this.$settings.BASE_URL_CMS + `timer/timerstop/`)
        .then((res) => {
          if (res.data.code == 100) {
            this.$message({
              message: res.data.msg,
              type: "success",
            });
          } else {
            this.$message.error(res.data.msg);
          }
        });
    },
    // 修改任务
    TestUpdate() {
      let data_Position = {
        I29_id: this.tableData.I29Position.id,
        is_picture: this.tableData.is_picture,
        picture_id: this.tableData.picture_one.id,
        light_id: this.tableData.LightPosition.id,
        cms_location_id: this.tableData.GuideRailPosition.id,
        kernel_id: this.tableData.KernelPosition.id,
        timer_hz: this.tableData.timer_hz,
      };

      // 如果tableData的KeylightPosition属性不为null
      if (this.tableData.KeylightPosition !== null) {
        // 将skylight属性添加到data_Position对象中
        data_Position["skylight"] = this.tableData.KeylightPosition.id;
      }
      if (this.tableData.PL1C05ONE !== null) {
        data_Position["pl1c05_location"] = this.tableData.PL1C05ONE.id;
      }
      console.log('--------')
      console.log(this.SelectiveShooting)
      console.log(this.Task_id)
      console.log('--------')
      this.$axios
        .patch(
          this.$settings.BASE_URL_CMS + `CMS-Task/getonetask/${this.Task_id}/`,
          {
            id: this.Task_id,
            I29: this.tableData.I29Position.id,
            is_picture: this.tableData.is_picture,
            picture: this.tableData.picture_one.id,
            light: this.tableData.LightPosition.id,
            cms_location: this.tableData.GuideRailPosition.id,
            timer_hz: this.tableData.timer_hz,
            kernel_id: this.tableData.KernelPosition.id,
          }
        )
        .then((res) => {
          if (res.data.code == 100) {
            this.$message({
              message: res.data.msg,
              type: "success",
            });
          } else {
            this.$message.error(res.data.msg);
          }
        });
    },
    startPolling() {

      if (this.options.length > 0) {
        // 如果已经有选项了，停止查询
        this.is_options = true;
        this.$set(this, "is_options", true);
        this.num = 5;
        this.$forceUpdate();

        return;
      }

      setTimeout(() => {
        // 进行查询操作
        this.startPolling(); // 递归调用
      }, 5000);
    },
    // 获取主任务ID
    GetMainId(submenu, index) {
      this.csx_list = submenu.TestItemAlways_ALL;
      this.isActive = index;
      this.isActive1 = null;
      this.SelectiveShooting = "";
      this.main_id = submenu.id;
    },
    GetSelective(submenu, index) {
      this.groupIndex = index;
      this.SelectiveShooting = submenu;
      console.log('SelectiveShooting', this.SelectiveShooting)
      console.log('data_data', submenu[0].id)
      this.$axios.get(this.$settings.BASE_URL_CMS + `CMS-Task/getonetask/${submenu[0].id}/`).then((res) => {
        console.log(res.data.code)
        console.log(res.data.data)
        if (res.data.code == 100) {
          this.tableData = res.data.data
        }
        console.log('tableData', this.tableData)
        this.isActive1 = index;
        this.isActive2 = 0;
      })
      this.TestALLName = index;
      this.Task_id = submenu[0].id;
      this.TestName = submenu[0].values;
    },

    TestALL(indexs) {
      let id = this.SelectiveShooting[indexs]["id"]; //通过index获取id
      //   console.log("当前 selectedItems 数组：", this.selectedItems);

      // 根据 id 判断是勾选还是取消勾选
      if (this.selectedItems.includes(id)) {
        // 如果已经在 selectedItems 中，说明是取消勾选，需要从列表中移除
        const index = this.selectedItems.indexOf(id);
        Vue.set(this.selectedItems, index, undefined); // 使用Vue.set进行修改

        this.selectedItems.splice(index, 1); // 再删除undefined项
        Object.keys(this.SelectiveShooting).forEach((key) => {

          const now_index = this.selectedItems.indexOf(
            this.SelectiveShooting[key]["id"]
          );
          this.SelectiveShooting[key]["sort"] = now_index + 1;
        });
      } else {
        // 如果不在 selectedItems 中，说明是勾选，需要添加到列表中
        this.selectedItems.push(id);
        this.SelectiveShooting[indexs]["sort"] = this.selectedItems.length;
      }

    },
    // 查找当前导轨的配置值
    UpdateTableDataGuideRailPosition() {
      this.$axios
        .get(
          this.$settings.BASE_URL_CMS +
          "CMS-Control/get-cms-guide/" +
          `${this.tableData.GuideRailPosition.id}` +
          "/"
        )
        .then((res) => {
          if (res.data.code == 100) {
            this.tableData.GuideRailPosition = res.data.data;
          }
        });
    },
    // 查找当前I29配置
    UpdateTableDataI29Position() {
      this.$axios
        .get(
          this.$settings.BASE_URL_CMS +
          `CMS-KM/I29List/${this.tableData.I29Position.id}/`
        )
        .then((res) => {
          if (res.data.code == 100) {
            this.tableData.I29Position = res.data.data;
          }
        });
    },
    LightPositionLightPosition() {
      this.$axios
        .get(
          this.$settings.BASE_URL_CMS +
          `Ccxl/LightList/${this.tableData.LightPosition.id}/`
        )
        .then((res) => {
          if (res.data.code == 100) {
            this.tableData.LightPosition = res.data.data;
          }
        });
    },
    SkyLightPosition() {
      this.$axios
        .get(
          this.$settings.BASE_URL_CMS +
          `lightauto/skylights/${this.tableData.KeylightPosition.id}/`
        )
        .then((res) => {
          if (res.data.code == 100) {
            this.tableData.KeylightPosition = res.data.data;
          }
        });
    },
    PL1C05Position() {
      this.$axios
        .get(
          this.$settings.BASE_URL_CMS +
          `PL1C05/PL1C05List/${this.tableData.PL1C05ONE.id}/`
        )
        .then((res) => {
          if (res.data.code == 100) {
            this.tableData.PL1C05ONE = res.data.data;
          }
        });
    },
    // 获取测试项下的配置
    TestOne(item, submenu) {
      this.$axios
        .get(
          this.$settings.BASE_URL_CMS + `CMS-Task/getonetask/${item.id}/`
        )
        .then((res) => {
          if (res.data.code == 100) {
            console.log('thmer', res.data.data)
            this.TestALLName = submenu;
            this.picture_sort = res.data.data.picture;
            this.TestName = item.values;
            this.tableData = res.data.data;
            this.csx_list = this.options[0].TestItemAlways_ALL;
            this.SelectiveShooting = this.options[0].TestItemAlways_ALL['帧率']
            this.TestName = this.options[0].TestItemAlways_ALL['帧率'][0].values
          }
        });
    },
    TestTwo(item, submenu, index) {
      console.log(item.id)
      console.log(submenu)
      console.log(index)
      this.$axios
        .get(
          this.$settings.BASE_URL_CMS + `CMS-Task/getonetask/${item.id}/`
        )
        .then((res) => {
          if (res.data.code == 100) {
            console.log('data', res.data.data)
            this.isActive2 = index;
            this.Task_id = item.id;
            this.TestALLName = submenu;
            this.TestName = item.values;
            this.tableData = res.data.data;
            this.picture_sort = res.data.data.picture_one;
          }
        });
    },
    // 开始任务
    //   TaskCopy(){
    //   this.$axios.get(this.$settings.BASE_URL_CMS+`task/maintaskcopy/?main_task_name=${}`).then((res)=>{
    //
    //   })
    //   },

    bring() {
      this.$axios
        .patch(this.$settings.BASE_URL_CMS + `CMS-Task/savefiles/1/`, {
          url: this.save_file.url,
          savefileone: this.save_file.savefileone,
        })
        .then((res) => {
          if (res.data.code == 100) {
            this.is_bring_on = false;
            this.$message("任务开始");
            this.$axios
              .get(
                this.$settings.BASE_URL_CMS +
                "CMS-Task/start_task/" +
                `?selectedItems=${this.selectedItems}`
              )
              .then((res) => {
                if (res.data.code == 100) {
                  this.$message({
                    message: res.data.msg,
                    type: "success",
                  });
                } else {
                  this.$message.error(res.data.msg);
                }
              })
              .catch((error) => {
                this.$message.error(error);
              });
          } else {
            this.$message.error("修改失败");
          }
        })
        .catch((error) => {
          this.$message.error(error);
        });
    },
    // 获取导轨位置
    GetCmsLocationList() {
      this.$axios
        .get(this.$settings.BASE_URL_CMS + "CMS-Control/get-cms-guide/")
        .then((res) => {
          if (res.data.code == 100) {
            this.cmslocationlist = res.data.data;
          }
        });
    },
    // 更新图卡列表
    updateGraphicCard(item) {
      // 根据选择更新图卡列表
      this.card_list = this.TestList[item - 1]["picture_relevance_in_one"];
    },
    // 跟新测试项列表
    updateTestItems(item) {
      // 根据选择更新测试项列表
      this.$axios
        .get(this.$settings.BASE_URL_CMS + "picture/testones/" + `?id=${item}`)
        .then((res) => {
          if (res.data.code == 100) {
            this.TestList = res.data.data;
          }
        });
    },
    // 获取图卡配置
    CardList() {
      this.$axios
        .get(this.$settings.BASE_URL_CMS + "CMS-Card/ListCard/")
        .then((res) => {
          if (res.data.code == 100) {
            console.log('card_list', res.data.data)
            this.card_list = res.data.data;
          }
        });
    },
    // 获取灯光配置
    LightList() {
      this.$axios
        .get(this.$settings.BASE_URL_CMS + "Ccxl/LightList/")
        .then((res) => {
          if (res.data.code == 100) {
            this.light_list = res.data.data;
          }
        });
    },
    // 获取I29配置
    I29List() {
      this.$axios
        .get(this.$settings.BASE_URL_CMS + "CMS-KM/I29List/")
        .then((res) => {
          if (res.data.code == 100) {
            this.I29 = res.data.data;
          }
        });
    },

    // 查询测试项
    GetTestList() {
      this.$axios
        .get(this.$settings.BASE_URL_CMS + "CMS-Task/getonetask/")
        .then((res) => {
          if (res.data.code == 100) {
            this.TestList = res.data.data;
          }
        });
    },
    handleClose_is_createtask(done) {
      this.$confirm("确认关闭？")
        .then((_) => {
          done();
        })
        .catch((_) => { });
    },
    createtask_dlg() {
      this.I29List();
      this.LightList();
      this.GetCmsLocationList();
    },
    createtask() {
      this.$axios
        .post(this.$settings.BASE_URL_CMS + "task/taskcreate/", {
          task_name: this.subtask,
          main: this.main_id,
          I29: this.I29_name,
          picture: this.picture_name,
          light: this.light_name,
          test_item: this.test_item_name,
          cms_location: this.cmslocation,
        })
        .then((res) => {
          if (res.data.code == 100) {
            this.$message({
              message: res.data.msg,
              type: "success",
            });
            this.tableData = res.data.data;
            this.is_createtask = false;
          }
        })
        .catch((error) => {
          this.$message.error(error);
        });
    },
    handleOpen(key, keyPath) {
    },
    handleClose(key, keyPath) {
    },
    // 获取当前主任务下的子任务

    // 获取所有主任务
    // async ListMainTask() {
    //   try {
    //     const res = await this.$axios.get(this.$settings.BASE_URL_CMS + 'task/maintask/');
    //     if (res.data.code === 100) {
    //       // this.$set(this.options,res.data.data)
    //       this.options = res.data.data;
    //       this.tableData = res.data.data[0]['task_list'];
    //       this.main_id = res.data.data[0]['id'];
    //     } else {
    //       this.options = ['任务获取失败'];
    //     }
    //   } catch (error) {
    //     console.error(error);
    //     this.options = ['发生了错误'];
    //   }
    // },
    ListMainTask() {
      try {
        this.$axios
          .get(this.$settings.BASE_URL_CMS + "CMS-Task/getalltask/")
          .then((res) => {
            if (res.data.code === 100) {
              this.options = res.data.data;
              // this.tableData = res.data.data[0]["task_list"];
              this.main_id = res.data.data[0]["id"];

              this.createtask_dlg();
              this.TestOne({ id: 1 }, "帧率");
              this.SkyLightList();
              this.startPolling();
              this.SunLightList();
            } else {
              this.options = ["任务获取失败"];
            }
          });
      } catch (error) {
        console.error(error);
        this.options = ["发生了错误"];
      }
    },
  },
  // 获取主任务下的测试项下的子测试项

};
</script>

<style lang="less">
#todo {
  .my_button_style {
    background-color: #262626;
  }

  .el-dialog {
    background-color: #262626 !important;
    color: #ccc;
    /*color: #ccc;*/
  }

  .el-dialog__title {
    color: #cccccc;
  }

  .zdg {
    //width: 1000px;
    //height: 16px;
    font-size: 20px;
    //font-family: Source Han Sans CN;
    //font-weight: 300;
    //color: #CCCCCC;
    //line-height: 52px;
    //margin-left: 30px;
    display: flex;
    align-items: center;
    margin-right: 20px;
    /* 间距，根据需要调整 */
  }

  .zdg222 {
    //width: 1000px;
    //height: 16px;
    font-size: 16px;
    //font-family: Source Han Sans CN;
    //font-weight: 300;
    //color: #CCCCCC;
    //line-height: 52px;
    //margin-left: 30px;
    display: flex;
    align-items: center;
    margin-right: 20px;
    /* 间距，根据需要调整 */
    margin-left: auto;
  }

  .margin-top {
    margin-top: -25px;
    /* 向上移动10像素，根据需要调整这个值 */
  }



  .container_I29 {
    line-height: 20px;
    margin-left: 60px;
    margin-top: 30px;
    margin-bottom: 19px;
    font-size: 20px;
    display: flex;
    justify-content: space-between;
  }

  .el-input__inner {
    background-color: #262626;
    color: #ccc;
    border-radius: 0px;
  }

  .el-message-box {
    background-color: #262626;
    color: #ccc;
    border: 0px solid #262626;
  }

  .el-message-box__content {
    color: #ccc;
  }

  .container2 {
    line-height: 20px;
    margin-left: 60px;
    margin-top: 19px;
    margin-bottom: 19px;
    font-size: 20px;
    display: flex;
    justify-content: space-between;
  }

  .container2> :not(:last-child) {
    margin-right: 20px;
  }



  .bottom-left-buttons {
    position: relative;
    bottom: 0;
    left: 0;
  }

  // .bottom-left-buttons1 {
  //   position: fixed;
  //   bottom: 200px;
  //   /* 距离底部的距离 */
  //   right: 0px;
  //   /* 距离右侧的距离 */
  //   z-index: 999;
  //   /* 可选，如果需要调整按钮的层级 */
  // }

  // .bottom-left-buttons2 {
  //   position: fixed;
  //   bottom: 0px;
  //   /* 距离底部的距离 */
  //   left: 140px;
  //   /* 距离右侧的距离 */
  //   z-index: 999;
  //   /* 可选，如果需要调整按钮的层级 */
  // }

  .xzps {
    width: 80px;
    height: 20px;
    font-size: 50px;
    font-weight: normal;
    color: #ffffff;
    line-height: 21px;
    margin-left: 60px;
    margin-top: 19px;
    margin-bottom: 19px;
  }

  .zrw {
    width: 80px;
    height: 20px;
    font-size: 20px;
    font-weight: normal;
    color: #ffffff;
    line-height: 21px;
    margin-left: 60px;
    margin-top: 19px;
    margin-bottom: 19px;
  }

  .zrwx {
    margin-left: 31px;
    width: 280px;
    height: 60px;
    background: #1b4181;
  }
  .globalValue{
    font-size: 20px;
    text-align: center;
    line-height: 50px;
    height: 50px;
  }
  .zrwx1 {
    margin-left: 31px;
    width: 280px;
    height: 60px;
    background: #1b4181;
  }

  .csx {
    width: 280px;
    height: 56px;
    background: #2d2d2d;
  }

  .zrwzt {
    width: 10%;
    height: 18px;
    font-size: 1.4em;
    font-family: Source Han Sans SC;
    font-weight: 400;
    color: #fefefe;
    line-height: 40px;

  }

  .csxrw {
    width: 10%;
    //height: 18px;
    font-size: 1.4em;
    font-weight: 400;
    color: #ffffff;
    line-height: 3.25;
    margin-left: 15%;
  }


  .el-checkbox {
    color: #ccc;
  }

  //.el-menu-item:hover {
  //color: #262626;
  //background-color: #262626 !important;
  //}

  .el-menu-item-group__title {
    font-size: 17px;
    background-color: #262626;
  }

  .el-menu .el-select-dropdown {
    background-color: black !important;
    color: white !important;
  }

  .el-header {
    background-color: #b3c0d1;
    color: #333;
    line-height: 60px;
  }

  .el-aside {
    color: #333;
  }

  .active {
    span {
      color: #00a8fc;
      /* 设置蓝色文字 */
    }
  }

  .overflow-x-hidden {
    overflow-x: hidden !important;
  }

  .page-todo {
    .myDiv {
      height: 200px;
    }

    // 检测屏幕宽度 自适应
    @media screen and (min-width: 1024px) and (max-width: 1500px) {
      .el-button {
        height: @h*3.7037037vh;
        line-height: 1;
        padding: 5px 8px;
        font-size: 1rem;
      }
    }

    .todo-box {
      // margin: @h*14vh @w*28vw 0 @w*32vw;
      display: flex;
      background: #2e2e2e;
      height: @h*1000vh;

      .left {
        margin-top: @h*20vh;
        width: @w*550vw;
        margin-left: @w*18vw;
        border: 1px solid #666;
        margin-bottom: @h*33vh;

        .el-menu-vertical-demo:not(.el-menu--collapse) {
          width: 200px;
          min-height: 400px;
        }

        .btn-box {
          height: @h*60vh;
          border-bottom: 1px solid #666;
          text-align: center;

          .maintask {
            height: @h*60vh;
            line-height: @h*60vh;
            width: @w*100vw;
            float: left;
          }

          .el-button {
            margin: @h*4vw @w*5vw;
            padding: @h*5vw @w*5vw;
            height: @h*20vw;
          }

          .el-dialog {
            width: @w*530vw;

            // height:@h*490vh;
            .el-dialog__header {
              height: @h*66vh;
              line-height: @h*66vh;
              border-bottom: 1px solid #ccc;
              padding: 0;
              padding-left: @w*40vw;
              text-align: left;
            }

            .el-dialog__body {
              padding: @h*40vh @w*50vw;

              .el-form-item {
                // margin-bottom: @h*40vh;
                display: flex;
              }

              .el-form-item__label {
                width: @w*130vw;
              }
            }

            .el-dialog__footer {
              text-align: center;
              // padding: 0;
            }
          }
        }

        .todo-list {
          display: flex;
          flex-direction: column;

          .active {
            background: rgba(22, 143, 255, 0.3);
            border-right: 2px solid rgba(22, 143, 255);
          }

          .todo-list-item {
            height: @h*60vh;
            line-height: @h*60vh;
            padding-left: @w*12vw;
            cursor: pointer;

            .spans {
              width: @w*200vw;
            }

            .num {
              margin-left: @w*8vw;
            }

            .el-checkbox__label {
              font-size: 1rem;
              font-family: Source Han Sans CN;
              font-weight: 400;
              color: #ffffff;
              width: 100%;
            }
          }
        }

        // 提示框样式
        .el-dialog {}
      }

      .right {
        margin: @h*20vh @w*22vw @h*33vh @w*20vw;
        width: 89.666667vw;
        border: 1px solid #666;

        // height: 866px;
        .sub-todo-info {
          .sub-top {
            height: @h*60vh;
            line-height: 5.407407vh;
            border-bottom: 1px solid #666;

            .top-title {
              float: left;
              padding-left: 3%;
              font-size: 1.125rem;
              font-family: Source Han Sans CN;
              font-weight: 400;
              color: #ffffff;
            }

            .top-add {
              float: right;
              padding-right: 3%;

              .el-dialog {
                width: @w*880vw;

                // height:@h*490vh;
                .el-dialog__header {
                  height: @h*66vh;
                  line-height: @h*66vh;
                  border-bottom: 1px solid #ccc;
                  padding: 0;
                  padding-left: @w*40vw;
                }

                .el-dialog__body {
                  padding: @h*40vh @w*50vw;

                  .el-form {
                    overflow: hidden;
                  }

                  .el-form-item {
                    margin-bottom: @h*40vh;
                    display: flex;
                    float: left;
                  }

                  .el-form-item__label {
                    width: @w*130vw;
                  }
                }

                .el-dialog__footer {
                  text-align: center;
                }
              }

              .el-button {
                width: @w*130vw;
                height: @h*40vh;
                text-align: center;
                border: none;
                // line-height: @h*40vh ;
              }
            }
          }

          .table {
            background: #2e2e2e;

            .el-dialog {
              width: @w*880vw;

              // height:@h*490vh;
              .el-dialog__header {
                height: @h*66vh;
                line-height: @h*66vh;
                border-bottom: 1px solid #ccc;
                padding: 0;
                padding-left: @w*40vw;
              }

              .el-dialog__body {
                padding: @h*40vh @w*50vw;

                .el-form {
                  overflow: hidden;
                }

                .el-form-item {
                  margin-bottom: @h*40vh;
                  display: flex;
                  float: left;
                }

                .el-form-item__label {
                  width: @w*130vw;
                }
              }

              .el-dialog__footer {
                text-align: center;
              }
            }

            .el-table__body-wrapper {
              background: #2e2e2e;
            }

            .el-table th {
              background: #383838;
              color: #fff;
              border-bottom: 1px solid #666;
              border-right: 1px solid #666;
              // height: 60px;
              // padding: 0;
            }

            .el-table tr {
              background: #2e2e2e;
              color: #fff;
              // height: 60px;
            }

            .el-table td {
              border-bottom: 1px solid #666;
              border-right: 1px solid #666;
              // padding: 0;
            }

            /* .el-table th.is-leaf {
                      border-bottom: 1px solid #666;
                      border-right: 1px solid #666;
                    } */

            .el-table::before {
              background-color: #666;
            }

            .el-table--enable-row-hover .el-table__body tr:hover>td {
              background-color: #2e2e2e;
            }
          }
        }
      }
    }
  }

  .el-aside {
    background-color: #f0f4f9;
    /* 柔和的蓝灰色 */
    color: #333333;
    /* 深灰色 */
  }

  /* 菜单项背景颜色、文字颜色 */
  .el-menu-item,
  .el-submenu {
    background-color: #262626;
    /* 白色背景 */
    color: #333333;
    /* 深灰色 */
  }

  .el-descriptions__body .el-descriptions__table .el-descriptions-item__cell {
    line-height: 2.2;
    background-color: #262626;
  }

  /* 菜单项激活状态样式 */
  .el-menu-item.is-active,
  .el-submenu.is-active {
    background-color: #f0f9ff;
    /* 淡蓝色 */
  }

  .el-input__inne2 {
    background-color: #262626;
    border-radius: 31px;
    height: 34px;
    width: 30%;
  }

  .el-input__icon {
    line-height: 33px;
  }

  .el-button:hover {
    background-color: #66b1ff;
    /* 淡蓝色 */
  }

  /* 描述列表样式 */
  .el-descriptions {
    background-color: #262626;
    /* 白色背景 */
    border: 1px solid #ebeef5;
    /* 淡蓝色边框 */
  }

  .el-descriptions-item {
    color: #ccc;
    /* 深灰色 */
  }

  .el-descriptions {
    color: #ccc;
    /* 深灰色 */
  }

  .el-submenu__title {
    color: #ccc;
    /* 深灰色 */
  }

  .el-input {
    border-color: #dcdfe6;
    /* 浅灰色边框 */
  }

  .el-select {
    //border-color: #dcdfe6; /* 浅灰色边框 */
    //background-color: black; /* 设置背景颜色为黑色 */
    //color: white; /* 设置文字颜色为白色 */
  }

  .el-select-dropdown .el-select-dropdown__item {
    background-color: #262626;
    /* 设置背景颜色为白色 */
  }

  .el-select-dropdown__list {
    background-color: #262626;
  }

  .el-descriptions-item__label {
    color: #ccc;
    /* 深灰色 */
  }

  /* 下拉选择框样式 */
  //.el-select {
  //  width: 10%; /* 设置宽度为100% */
  //}

  .el-select__input {
    height: 20px;
    /* 设置输入框高度 */
    border-color: #dcdfe6;
    /* 浅灰色边框 */
  }

  .el-select__caret {
    color: #909399;
    /* 灰色下拉箭头 */
  }

  .el-option {
    color: #333333;
    /* 深灰色 */
  }



  .el-option:hover {
    background-color: #f0f9ff;
    /* 鼠标悬停时的背景颜色 */
  }

  .el-table--enable-row-transition .el-table__body td.el-table__cell {
    background-color: #333;
    color: #fff;
  }

  .el-table--striped .el-table__body tr.el-table__row--striped td.el-table__cell {
    background-color: #333;
    color: #fff;
  }

  .el-option.is-selected {
    background-color: #409eff;
    /* 已选项的背景颜色 */
    color: #ffffff;
    /* 白色文本 */
  }

  .loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 89vh;
    /* 设置高度为视窗的100% */
    transform: scale(1.5);
    /* 放大1.5倍，可以根据需要调整 */
    margin: 0 auto;
    /* 将元素水平居中 */

    opacity: 1;
    /* 设置透明度为50%，使其镂空 */
    color: white;
    /* 设置文字颜色为白色 */
    padding: 0px;
    /* 可选：增加内边距，使文字与边界有间距 */
    border-radius: 10px;
    /* 可选：添加圆角边框 */
    font-size: 100px;
    /* 设置文字大小为 20 像素，可以根据需要调整 */
    color: transparent;
    /* 将文字颜色设为透明 */
    -webkit-text-stroke: 2px #00a8fc;
    /* 设置文字镂空效果，1px是描边的宽度，black是描边的颜色 */
    text-fill-color: transparent;
    /* 兼容性设置，使得在某些浏览器中也可以显示镂空效果 */
  }

  .loading-container2 {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 70vh;
    /* 设置高度为视窗的100% */
    transform: scale(0.8);
    /* 放大1.5倍，可以根据需要调整 */
    margin: 0 auto;
    /* 将元素水平居中 */

    opacity: 1;
    /* 设置透明度为50%，使其镂空 */
    color: white;
    /* 设置文字颜色为白色 */
    padding: 0px;
    /* 可选：增加内边距，使文字与边界有间距 */
    border-radius: 10px;
    /* 可选：添加圆角边框 */
    font-size: 90px;
    /* 设置文字大小为 20 像素，可以根据需要调整 */
    color: transparent;
    /* 将文字颜色设为透明 */
    -webkit-text-stroke: 2px #00a8fc;
    /* 设置文字镂空效果，1px是描边的宽度，black是描边的颜色 */
    text-fill-color: transparent;
    /* 兼容性设置，使得在某些浏览器中也可以显示镂空效果 */
  }

  /* 如果需要更多样式调整，请随时告诉我！ */


  .el-table th.el-table__cell {
    background-color: #262626;
    /* 这里设置为想要的背景颜色 */
  }

  height: 100%;

  .el-row {
    height: 100%;
  }

  .zrw {
    margin: 0;
    margin-top: @h*30vh;
    padding-bottom: @h*20vh;
    width: 100%;
    text-align: center;
    border-bottom: 1px solid #909399;

  }

  .el-col-7 {
    height: 92%;
  }

  .el-col-13 {
    font-size: @h*30vh;
    height: 93%;
    padding-bottom: @h*50vh;
    .container_list{
      height: 90%;
      overflow: auto;
    }
    .container {
      padding: 0;
      margin: 0;
      width: 100%;
      float: left;
      height: auto;
      margin-bottom: @h*40vh !important;

      // min-height: @h*120vh ;
      .left-content {
        width: 95%;
        float: left;
        line-height: @h*50vh;
        height: @h*50vh;
        margin: @h*20vh @w*20vw;
        // padding-bottom: @h*0vh;
        border-bottom: 1px solid #909399;



      }

      .left-content-light {
        width: 95%;
        float: left;
        line-height: @h*50vh;
        height: @h*50vh;
        margin: @h*20vh @w*20vw;
        padding-bottom: @h*10vh;
        // border-bottom: 1px solid #909399;
        font-size: @w*25vw;

        .el-select {
          width: @w*250vw;
          // height: @h*30vh;

          margin: 0 @w*20vw;


        }

      }

      .right-content {
        width: 45%;
        float: left;
        margin: @h*10vh @w*20vw;
        font-size: @w*25vw;

        .el-select {
          width: @w*240vw;
          // height: @h*30vh;

          margin: 0 @w*20vw;


        }

        .el-button {
          height: @h*30vh;

          margin-top: -@h*15vh;

          color: #00a8fc;

          text-align: center;
          border: 0;
          background: none;
          // background-color: rgb(38, 38, 38);
        }
      }
    }
  }

  .task {
    height: 100%;
    background: #161D26;
  }

  .secondtask {
    height: 100%;
    background: #1F2935;

    .stlist {
      height: 92%;
      overflow: auto;

      .st {
        margin: 0 @w*10vw;
      }
    }

  }

  .el-col-4 {
    height: 100%;
    background: #1F2935;

    .custom-table {

      border: none;
    }

  }
  .el-col-24{
    background-color: #1F2935;
    .custom-table {

      background-color: #1F2935;
      .el-table{
        background-color: #1F2935;
        border: none;
        margin: 0 !important;
        padding: 0;
      }
}
  }

  .tud {
    float: right;
    margin-right: @w*20vw;

    .el-button {
      float: right;
      color: #fff;
      margin: 0 @w*10vw;
      // background-color: #00a8fc;
    }

    .fileandstart {
      float: right;
      margin: @h*20vh 0;

      input {
        height: @h*50vh;
        width: @w*500vw;
      }
    }
  }


}
</style>
